<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input type="text"  v-model.trim.lazy="username"
             placeholder="enter the name you search"/>
      <button @click="getList">Search</button>
    </div>
  </section>
</template>

<script>
    import {mapActions} from "vuex"
    export default {
        name: "v-search",
        computed:{
          username:{
            get(){return this.$store.state.username},
            set(val){
              //同步逻辑  直接commit mutation来修改仓库中的数据
              this.searchName(val)
            }
          }
        },
        methods:{
          ...mapActions(["searchName","getList"]),
        }
    }
</script>

<style scoped>

</style>
